Imports Microsoft.VisualBasic
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Imports System.Data
Imports DataAccesGenerales
Imports DataAcces

Public Class DataAccesMigracion_Salida
  Private Const consTimeOut As Integer = 0 

    ''' <summary>
    ''' Funcion para Insertar un regristro en la tabla Migracion_Salida
    ''' </summary>
   Public Function Migracion_Salida_InsertarModificar(pnidDocumento As Long, pnidCaptSalida As Long, pfecha_Zarpe As String, ppuertoMaritimo As String, pbuqueMotor As String, pbandera As String, pmatricula As String, pnidTipo_Buque As Integer, pprocedencia As String, pdestino As String, pnidtrafico As Integer, ppesobruto As Double, ppesoneto As Double, pcapitan As String, pnacionalidad As String, ptripulantes As Integer, ppasajeros As Integer, pterminal As String, pcargamento As String, pestadia As Integer, pmuelle As String, pfacturar As String, prfc As String, pdireccion As String, pnidviaje As Long, pobservaciones As String) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaInsertarModificar"
          oraCommandDocumentos.Parameters.Add("pnidDocumento", pnidDocumento)
          oraCommandDocumentos.Parameters.Add("pnidCaptSalida", pnidCaptSalida)
          oraCommandDocumentos.Parameters.Add("pfecha_Zarpe", pfecha_Zarpe)
          oraCommandDocumentos.Parameters.Add("ppuertoMaritimo", ppuertoMaritimo)
          oraCommandDocumentos.Parameters.Add("pbuqueMotor", pbuqueMotor)
          oraCommandDocumentos.Parameters.Add("pbandera", pbandera)
          oraCommandDocumentos.Parameters.Add("pmatricula", pmatricula)
          oraCommandDocumentos.Parameters.Add("pnidTipo_Buque", pnidTipo_Buque)
          oraCommandDocumentos.Parameters.Add("pprocedencia", pprocedencia)
          oraCommandDocumentos.Parameters.Add("pdestino", pdestino)
          oraCommandDocumentos.Parameters.Add("pnidtrafico", pnidtrafico)
          oraCommandDocumentos.Parameters.Add("ppesobruto", ppesobruto)
          oraCommandDocumentos.Parameters.Add("ppesoneto", ppesoneto)
          oraCommandDocumentos.Parameters.Add("pcapitan", pcapitan)
          oraCommandDocumentos.Parameters.Add("pnacionalidad", pnacionalidad)
          oraCommandDocumentos.Parameters.Add("ptripulantes", ptripulantes)
          oraCommandDocumentos.Parameters.Add("ppasajeros", ppasajeros)
          oraCommandDocumentos.Parameters.Add("pterminal", pterminal)
          oraCommandDocumentos.Parameters.Add("pcargamento", pcargamento)
          oraCommandDocumentos.Parameters.Add("pestadia", pestadia)
          oraCommandDocumentos.Parameters.Add("pmuelle", pmuelle)
          oraCommandDocumentos.Parameters.Add("pfacturar", pfacturar)
          oraCommandDocumentos.Parameters.Add("prfc", prfc)
          oraCommandDocumentos.Parameters.Add("pdireccion", pdireccion)
          oraCommandDocumentos.Parameters.Add("pnidviaje", pnidviaje)
          oraCommandDocumentos.Parameters.Add("pobservaciones", pobservaciones)

                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
    ''' <summary>
    ''' Funcion para consultar un registro de la tabla Migracion_Salida
    ''' </summary>
    ''' <param name="pNidDocumento">numero de documento</param>
    ''' <returns>DataTable</returns>
    ''' <remarks></remarks>
   Public Function Migracion_Salida_Consultar(pNidDocumento As Long) As DataTable
        Dim dtResultado As New DataTable("Migracion_SalidaConsulta")
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaConsultar"
                    oraCommandDocumentos.Parameters.Add("pNidDocumento", pNidDocumento)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pCursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    oraDataAdapter.Fill(dtResultado)
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dtResultado
    End Function
  
    ''' <summary>
    ''' Funcion para generar la cadena XML Chilkat del documento de la tabla Migracion_Salida
    ''' </summary>
    ''' <param name="nidDocumento"> numero del documento</param>
    ''' <returns>Chilkat.Xml</returns>
    ''' <remarks></remarks>
   Public Function Migracion_Salida_CadenaOriginalXMLChilkat(nidDocumento As Long) As Chilkat.Xml
        Dim detalleDataSet As New DataSet("DatosMigracion_Salida")
        Try
      detalleDataSet = Migracion_Salida_DetalleXML(nidDocumento)
            'En esta parte van las tablas obtenidas en la consulta anterior
            'separadas dependiendo del reporte a crear, ejemplo:
            detalleDataSet.Tables(0).TableName = "Informacion del Tramite"
            detalleDataSet.Tables(1).TableName = "Datos Migracion_Salida"
            detalleDataSet.Tables(2).TableName = "Archivos Anexos"
            detalleDataSet.Tables(3).TableName = "Incidencias"

            Dim xml As New Chilkat.Xml
            xml.LoadXml(detalleDataSet.GetXml())
            Return xml 'detalleDataSet.GetXml()
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    ''' <summary>
    ''' Funcion para consultar el detalle del documento de la tabla Migracion_Salida
    ''' </summary>
    ''' <param name="pNidDocumento">numero del documento</param>
    ''' <returns>DataSet</returns>
    ''' <remarks></remarks>
   Public Function Migracion_Salida_DetalleXML(pNidDocumento As Long) As DataSet
        Dim dsDetalle As New DataSet("Migracion_SalidaDetalle")
        Dim pTransaccion As Byte = 0
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaDetalleXML"
                    oraCommandDocumentos.Parameters.Add("pNidDocumento", pNidDocumento)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    'En esta parte es para los cursores necesario 
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pEncabezado", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pDatos", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pAnexos", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pIncidencias", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    'pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    oraDataAdapter.Fill(dsDetalle)
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dsDetalle
    End Function
  
   Public Function Migracion_Salida_DatosBase() As DataTable
        Dim dtResultado As New DataTable("Migracion_SalidaConsulta")
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaDatosBase"
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pCursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    oraDataAdapter.Fill(dtResultado)
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dtResultado
    End Function
  
    ''' <summary>
    ''' Funcion para Insertar un regristro en la tabla Migracion_Salida
    ''' </summary>
   Public Function Migracion_Salida_Insertar(pnidDocumento As Long, pnidCaptSalida As Long, pfecha_Zarpe As String, ppuertoMaritimo As String, pbuqueMotor As String, pbandera As String, pmatricula As String, pnidTipo_Buque As Integer, pprocedencia As String, pdestino As String, pnidtrafico As Integer, ppesobruto As Double, ppesoneto As Double, pcapitan As String, pnacionalidad As String, ptripulantes As Integer, ppasajeros As Integer, pterminal As String, pcargamento As String, pestadia As Integer, pmuelle As String, pfacturar As String, prfc As String, pdireccion As String, pnidviaje As Long, pobservaciones As String) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaInsertar"
          oraCommandDocumentos.Parameters.Add("pnidDocumento", pnidDocumento)
          oraCommandDocumentos.Parameters.Add("pnidCaptSalida", pnidCaptSalida)
          oraCommandDocumentos.Parameters.Add("pfecha_Zarpe", pfecha_Zarpe)
          oraCommandDocumentos.Parameters.Add("ppuertoMaritimo", ppuertoMaritimo)
          oraCommandDocumentos.Parameters.Add("pbuqueMotor", pbuqueMotor)
          oraCommandDocumentos.Parameters.Add("pbandera", pbandera)
          oraCommandDocumentos.Parameters.Add("pmatricula", pmatricula)
          oraCommandDocumentos.Parameters.Add("pnidTipo_Buque", pnidTipo_Buque)
          oraCommandDocumentos.Parameters.Add("pprocedencia", pprocedencia)
          oraCommandDocumentos.Parameters.Add("pdestino", pdestino)
          oraCommandDocumentos.Parameters.Add("pnidtrafico", pnidtrafico)
          oraCommandDocumentos.Parameters.Add("ppesobruto", ppesobruto)
          oraCommandDocumentos.Parameters.Add("ppesoneto", ppesoneto)
          oraCommandDocumentos.Parameters.Add("pcapitan", pcapitan)
          oraCommandDocumentos.Parameters.Add("pnacionalidad", pnacionalidad)
          oraCommandDocumentos.Parameters.Add("ptripulantes", ptripulantes)
          oraCommandDocumentos.Parameters.Add("ppasajeros", ppasajeros)
          oraCommandDocumentos.Parameters.Add("pterminal", pterminal)
          oraCommandDocumentos.Parameters.Add("pcargamento", pcargamento)
          oraCommandDocumentos.Parameters.Add("pestadia", pestadia)
          oraCommandDocumentos.Parameters.Add("pmuelle", pmuelle)
          oraCommandDocumentos.Parameters.Add("pfacturar", pfacturar)
          oraCommandDocumentos.Parameters.Add("prfc", prfc)
          oraCommandDocumentos.Parameters.Add("pdireccion", pdireccion)
          oraCommandDocumentos.Parameters.Add("pnidviaje", pnidviaje)
          oraCommandDocumentos.Parameters.Add("pobservaciones", pobservaciones)

                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function

    ''' <summary>
    ''' Funcion para Modificar un regristro en la tabla Migracion_Salida
    ''' </summary>
   Public Function Migracion_Salida_Modificar(pnidDocumento As Long, pnidCaptSalida As Long, pfecha_Zarpe As String, ppuertoMaritimo As String, pbuqueMotor As String, pbandera As String, pmatricula As String, pnidTipo_Buque As Integer, pprocedencia As String, pdestino As String, pnidtrafico As Integer, ppesobruto As Double, ppesoneto As Double, pcapitan As String, pnacionalidad As String, ptripulantes As Integer, ppasajeros As Integer, pterminal As String, pcargamento As String, pestadia As Integer, pmuelle As String, pfacturar As String, prfc As String, pdireccion As String, pnidviaje As Long, pobservaciones As String) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaModificar"
          oraCommandDocumentos.Parameters.Add("pnidDocumento", pnidDocumento)
          oraCommandDocumentos.Parameters.Add("pnidCaptSalida", pnidCaptSalida)
          oraCommandDocumentos.Parameters.Add("pfecha_Zarpe", pfecha_Zarpe)
          oraCommandDocumentos.Parameters.Add("ppuertoMaritimo", ppuertoMaritimo)
          oraCommandDocumentos.Parameters.Add("pbuqueMotor", pbuqueMotor)
          oraCommandDocumentos.Parameters.Add("pbandera", pbandera)
          oraCommandDocumentos.Parameters.Add("pmatricula", pmatricula)
          oraCommandDocumentos.Parameters.Add("pnidTipo_Buque", pnidTipo_Buque)
          oraCommandDocumentos.Parameters.Add("pprocedencia", pprocedencia)
          oraCommandDocumentos.Parameters.Add("pdestino", pdestino)
          oraCommandDocumentos.Parameters.Add("pnidtrafico", pnidtrafico)
          oraCommandDocumentos.Parameters.Add("ppesobruto", ppesobruto)
          oraCommandDocumentos.Parameters.Add("ppesoneto", ppesoneto)
          oraCommandDocumentos.Parameters.Add("pcapitan", pcapitan)
          oraCommandDocumentos.Parameters.Add("pnacionalidad", pnacionalidad)
          oraCommandDocumentos.Parameters.Add("ptripulantes", ptripulantes)
          oraCommandDocumentos.Parameters.Add("ppasajeros", ppasajeros)
          oraCommandDocumentos.Parameters.Add("pterminal", pterminal)
          oraCommandDocumentos.Parameters.Add("pcargamento", pcargamento)
          oraCommandDocumentos.Parameters.Add("pestadia", pestadia)
          oraCommandDocumentos.Parameters.Add("pmuelle", pmuelle)
          oraCommandDocumentos.Parameters.Add("pfacturar", pfacturar)
          oraCommandDocumentos.Parameters.Add("prfc", prfc)
          oraCommandDocumentos.Parameters.Add("pdireccion", pdireccion)
          oraCommandDocumentos.Parameters.Add("pnidviaje", pnidviaje)
          oraCommandDocumentos.Parameters.Add("pobservaciones", pobservaciones)

                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
    ''' <summary>
    ''' Funcion para generar un combo de la tabla Migracion_Salida
    ''' </summary>
    ''' <param name="pNombre">nombre a buscar en la tabla</param>
    ''' <returns>DataTable</returns>
    ''' <remarks>si el nombre es "" retornara todos los registros</remarks>
   Public Function Migracion_Salida_Combo(pNombre As String) As DataTable
        Dim dtResultado As New DataTable("Migracion_SalidaCombo")
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaCombo"
                    oraCommandDocumentos.Parameters.Add("pNombre", pNombre)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pCursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    oraDataAdapter.Fill(dtResultado)
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dtResultado
    End Function
  
    ''' <summary>
    ''' Funcion para generar la integracion del documento de la tabla Migracion_Salida
    ''' </summary>
    ''' <param name="pNidDocumento">numero del documento</param>
    ''' <returns>Byte</returns>
    ''' <remarks></remarks>
   Public Function Migracion_Salida_Integracion(pNidDocumento As Long) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaIntegracion"
                    oraCommandDocumentos.Parameters.Add("pNidDocumento", pNidDocumento)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
   Public Function Migracion_Salida_Borrar(pnid As Long) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.Migracion_SalidaBorrar"
                    oraCommandDocumentos.Parameters.Add("pnid", pnid)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
  
End Class
